package cloud.misiro.module.system.service.logger;

import cloud.misiro.framework.common.util.object.BeanUtils;
import cloud.misiro.module.system.api.logger.dto.LoginLogCreateReqDTO;
import cloud.misiro.module.system.dal.dataobject.logger.LoginLogDO;
import cloud.misiro.module.system.dal.mysql.logger.LoginLogMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;

/**
 * 登录日志 Service 实现
 */
@Service
@Validated
public class LoginLogServiceImpl implements LoginLogService{

    @Resource
    private LoginLogMapper loginLogMapper;

    /**
     * 创建登录日志
     *
     * @param reqDTO 日志信息
     */
    @Override
    public void createLoginLog(LoginLogCreateReqDTO reqDTO) {
        LoginLogDO loginLogDO = BeanUtils.toBean(reqDTO, LoginLogDO.class);
        loginLogMapper.insert(loginLogDO);
    }
}
